/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author grillo
 */
@Entity
@Table(name = "pagamentotasse")
@NamedQueries({@NamedQuery(name = "PagamentoTasse.findAll", query = "SELECT p FROM PagamentoTasse p"), @NamedQuery(name = "PagamentoTasse.findByMatricola", query = "SELECT p FROM PagamentoTasse p WHERE p.pagamentoTassePK.matricola = :matricola"), @NamedQuery(name = "PagamentoTasse.findByAnno", query = "SELECT p FROM PagamentoTasse p WHERE p.pagamentoTassePK.anno = :anno"), @NamedQuery(name = "PagamentoTasse.findByRata1", query = "SELECT p FROM PagamentoTasse p WHERE p.rata1 = :rata1"), @NamedQuery(name = "PagamentoTasse.findByValore1", query = "SELECT p FROM PagamentoTasse p WHERE p.valore1 = :valore1"), @NamedQuery(name = "PagamentoTasse.findByRata2", query = "SELECT p FROM PagamentoTasse p WHERE p.rata2 = :rata2"), @NamedQuery(name = "PagamentoTasse.findByValore2", query = "SELECT p FROM PagamentoTasse p WHERE p.valore2 = :valore2")})
public class PagamentoTasse implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected PagamentoTassePK pagamentoTassePK;
    @Basic(optional = false)
    @Column(name = "rata1")
    private boolean rata1;
    @Basic(optional = false)
    @Column(name = "valore1")
    private double valore1;
    @Basic(optional = false)
    @Column(name = "rata2")
    private boolean rata2;
    @Basic(optional = false)
    @Column(name = "valore2")
    private double valore2;
    @JoinColumn(name = "matricola", referencedColumnName = "matricola", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Studente studente;

    public PagamentoTasse() {
    }

    public PagamentoTasse(PagamentoTassePK pagamentoTassePK) {
        this.pagamentoTassePK = pagamentoTassePK;
    }

    public PagamentoTasse(PagamentoTassePK pagamentoTassePK, boolean rata1, double valore1, boolean rata2, double valore2) {
        this.pagamentoTassePK = pagamentoTassePK;
        this.rata1 = rata1;
        this.valore1 = valore1;
        this.rata2 = rata2;
        this.valore2 = valore2;
    }

    public PagamentoTasse(int matricola, int anno) {
        this.pagamentoTassePK = new PagamentoTassePK(matricola, anno);
    }

    public PagamentoTassePK getPagamentoTassePK() {
        return pagamentoTassePK;
    }

    public void setPagamentoTassePK(PagamentoTassePK pagamentoTassePK) {
        this.pagamentoTassePK = pagamentoTassePK;
    }

    public boolean getRata1() {
        return rata1;
    }

    public void setRata1(boolean rata1) {
        this.rata1 = rata1;
    }

    public double getValore1() {
        return valore1;
    }

    public void setValore1(double valore1) {
        this.valore1 = valore1;
    }

    public boolean getRata2() {
        return rata2;
    }

    public void setRata2(boolean rata2) {
        this.rata2 = rata2;
    }

    public double getValore2() {
        return valore2;
    }

    public void setValore2(double valore2) {
        this.valore2 = valore2;
    }

    public Studente getStudente() {
        return studente;
    }

    public void setStudente(Studente studente) {
        this.studente = studente;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pagamentoTassePK != null ? pagamentoTassePK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PagamentoTasse)) {
            return false;
        }
        PagamentoTasse other = (PagamentoTasse) object;
        if ((this.pagamentoTassePK == null && other.pagamentoTassePK != null) || (this.pagamentoTassePK != null && !this.pagamentoTassePK.equals(other.pagamentoTassePK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.PagamentoTasse[pagamentoTassePK=" + pagamentoTassePK + "]";
    }

}
